import minusjudge.SecProfile
import minusjudge.SecUser
import minusjudge.SecUserSecProfile

class BootStrap {

    def init = { servletContext ->
        def adminRole=new SecProfile(authority:'ROLE_ADMIN').save(flush:true)
        def userRole= new SecProfile(authority: 'ROLE_USER').save(flush:true)
        
        def testUser=new SecUser(username:'me',enabled:true,password:'pass')
        testUser.save(flush:true)
        
        SecUserSecProfile.create testUser,adminRole,true
        
        assert SecUser.count()==1
        assert SecProfile.count()==2
        assert SecUserSecProfile.count()==1
    }
    def destroy = {
    }
}
